<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: cherishy
  Date: 2020/7/29
  Time: 16:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>图书管理系统</title>
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">

    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>书籍列表</small>
                </h1>
            </div>
        </div>

        <div class="row">
            <div class="col-md-6 column" ><a href="${pageContext.request.contextPath}/book/toMain">返回主页</a> </div>
            <div class="col-md-4 column" style="text-align: right" >
                <form class="form-inline" action="${pageContext.request.contextPath}/book/queryBookByName" method="post">
                <div class="form-group">
                    <div class="input-group">
                        <input type="text" class="form-control" name="bookName" placeholder="请输入要查询的书籍名字">
                    </div>
                </div>
                <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button>
                </form>
            </div>
            <div class="col-md-2 column" style="text-align: right">
                <a href="${pageContext.request.contextPath}/book/toAddBook" class="btn btn-info">添加书籍</a>
                <a href="${pageContext.request.contextPath}/toUpload" class="btn btn-info">文件上传</a>
            </div>
        </div>
    </div>

    <div class="row clear">
        <div class="col-md-12 column">
            <table class="table table-hover table-striped">
                <thead>
                    <tr>
                        <th>书籍编号</th>
                        <th>书籍名称</th>
                        <th>书籍数量</th>
                        <th>书籍描述</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <c:forEach var="book" items="${list}">
                        <tr>
                            <td>${book.bookID}</td>
                            <td>${book.bookName}</td>
                            <td>${book.bookCounts}</td>
                            <td>${book.detail}</td>
                            <td>
                                <a href="${pageContext.request.contextPath}/book/toUpdate/${book.bookID}" style="text-decoration: none"><%--修改--%>
                                    <button type="button" class="btn btn-primary">
                                        <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
                                    </button>
                                </a>
                                &nbsp; &nbsp;
                                <a href="${pageContext.request.contextPath}/book/deleteBook/${book.bookID}" onclick="return confirm('确定要删除吗？')"><%--删除--%>
                                    <button type="button" class="btn btn-danger">
                                        <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
                                    </button>
                                </a>
                            </td>
                        </tr>
                    </c:forEach>
                </tbody>
            </table>
        </div>
    </div>

</div>
</body>
</html>
